import logging

import pytest

from resource.pom.settings import Settings


class Test:
    app = Settings

    @pytest.mark.parametrize('setup_teardown', [app.bundle_name], indirect=True)
    def test(self, setup_teardown, device):
        for i in range(5):
            logging.info('步骤1.{}：进入设置应用'.format(i))
            device.start_ability(self.app.bundle_name, self.app.ability_name)
            logging.info('预期结果1.{}：设置应用打开无卡死、黑屏、白屏等现象'.format(i))
            device.assert_current_window(self.app.window_name)
            device.refresh_layout()
            device.assert_text_exist('设置')
            device.assert_text_exist('搜索设置项')
            device.assert_text_exist('WLAN')
            device.assert_text_exist('蓝牙')
            device.assert_text_exist('移动网络')
            device.assert_text_exist('显示与亮度')
            device.assert_text_exist('声音')
            device.assert_text_exist('生物识别和密码')
            device.assert_text_exist('应用')
            device.assert_text_exist('存储')
            device.assert_text_exist('隐私')
            device.assert_text_exist('辅助功能')
            device.go_home()
            device.wait(1)
